package com.example.demo.utils;

import org.apache.shiro.subject.Subject;
import org.apache.shiro.util.ThreadContext;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;

public class ShiroUtils {
    public static void bindSubject(DefaultWebSecurityManager securityManager) {
        // 创建 Subject
        Subject subject = new Subject.Builder(securityManager).buildSubject();
        // 绑定到当前线程
        ThreadContext.bind(subject);
    }
}
